home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 008a / fgdemo10.zip / VIDEO.C < prev    next >
Text File  |  1991-10-05  |  8KB  |  295 lines

  1. /**********************************************************************\
  2. *                                                                      *
  3. *  video.c -- things on the video menu                                 *
  4. *                                                                      *
  5. \**********************************************************************/
  6.  
  7. #include "defs.h"
  8.  
  9. /**********************************************************************\
  10. *                                                                      *
  11. *  about_modes -- information about video modes                        *
  12. *                                                                      *
  13. \**********************************************************************/
  14.  
  15. int about_modes()
  16. {
  17.    static char *string[] = {
  18.    "Video Modes",
  19.    "Fastgraph supports 20 video modes.  One of the",
  20.    "major advantages of programming with Fastgraph",
  21.    "is the ability to write code one time to work in",
  22.    "many video modes. This demo, for example, will",
  23.    "work in your choice of four video modes."
  24.    };
  25.  
  26.    /* clear the screen and display the info window */
  27.  
  28.    fg_mousevis(OFF);
  29.    fg_restore(0,xlimit,menu_bottom,ylimit);
  30.    info_window(120,520,60,string,6);
  31.  
  32.    /* wait for keystroke or mouse button */
  33.  
  34.    fg_mousevis(ON);
  35.    wait_for_keystroke();
  36.  
  37.    /* clear the screen and return to the menu */
  38.  
  39.    fg_mousevis(OFF);
  40.    fg_restore(0,xlimit,menu_bottom,ylimit);
  41.  
  42.    fg_mousevis(ON);
  43.    redraw = TRUE;
  44.  
  45.    return(OK);
  46. }
  47.  
  48. /**********************************************************************\
  49. *                                                                      *
  50. *  auto_detect -- what modes are available on your machine?            *
  51. *                                                                      *
  52. \**********************************************************************/
  53.  
  54. int auto_detect()
  55. {
  56.    int x1,x2,y1,y2;
  57.    int row,col;
  58.  
  59.    static char *string[] = {
  60.    "Automatic Mode Detection",
  61.    "Your system will support the following video modes:",
  62.    "","","","","","","","","","","","","","","","","","","","",""
  63.    };
  64.  
  65.    static char mode_string[] = {"This program is running in mode    "};
  66.  
  67.    static char *mode_description[] = {
  68.    "  Mode  0  40x25 \"colorless\" text",
  69.    "  Mode  1  40x25 color text",
  70.    "  Mode  2  80x25 \"colorless\" text",
  71.    "  Mode  3  80x25 color text",
  72.    "  Mode  4  320x200 CGA 4-color graphics",
  73.    "  Mode  5  320x200 CGA 4-color \"colorless\" graphics",
  74.    "  Mode  6  640x200 CGA 2-color graphics",
  75.    "  Mode  7  80x25 monochrome text",
  76.    "  Mode  9  320x200 Tandy/PCjr 16-color graphics",
  77.    "  Mode 11  720x348 Hercules monochrome graphics",
  78.    "  Mode 12  320x200 Hercules monochrome graphics",
  79.    "  Mode 13  320x200 EGA 16-color graphics",
  80.    "  Mode 14  640x200 EGA 16-color graphics",
  81.    "  Mode 15  640x350 EGA monochrome graphics",
  82.    "  Mode 16  640x350 EGA 16-color graphics",
  83.    "  Mode 17  640x480 VGA/MCGA 2-color graphics",
  84.    "  Mode 18  640x480 VGA 16-color graphics",
  85.    "  Mode 19  320x200 VGA/MCGA 256-color graphics",
  86.    "  Mode 20  320x200 VGA 256-color graphics",
  87.    "  Mode 21  320x400 VGA 256-color graphics"
  88.    };
  89.  
  90.    static int mode_number[] = {
  91.    0,1,2,3,4,5,6,7,9,11,12,13,14,15,16,17,18,19,20,21
  92.    };
  93.  
  94.    register int i, j;
  95.  
  96.    /* test the modes and build an array of description strings */
  97.  
  98.    j = 2;
  99.    for (i = 0; i <= 20; i++)
  100.    {
  101.       if (fg_testmode(mode_number[i],1))
  102.          string[j++] = mode_description[i];
  103.    }
  104.  
  105.    /* insert the current mode in the last string */
  106.  
  107.    sprintf(&mode_string[32],"%d.",fg_getmode());
  108.    string[j++] = mode_string;
  109.  
  110.    /* clear the screen and display the info window */
  111.  
  112.    fg_mousevis(OFF);
  113.    fg_restore(0,xlimit,menu_bottom,ylimit);
  114.  
  115.    fg_setpage(hidden);
  116.  
  117.    if (mode11)
  118.    {
  119.       x1 = 80;
  120.       x2 = 570;
  121.    }
  122.    else
  123.    {
  124.       x1 = 100;
  125.       x2 = 540;
  126.    }
  127.    y1 = fg_yconvert(4);
  128.    y2 = fg_yconvert(5+j)+scale(10);
  129.  
  130.    draw_window(x1,x2,y1,y2,string[0]);
  131.    fg_setcolor(0);
  132.  
  133.    row = 6;
  134.    if (mode11)
  135.       col = 11;
  136.    else
  137.       col = 15;
  138.    for (i = 1; i < j; i++)
  139.    {
  140.       put_tstring(string[i],row,col);
  141.       row++;
  142.    }
  143.  
  144.    fg_setcolor(0);
  145.    fg_setpage(visual);
  146.    fg_restore(0,xlimit,menu_bottom,ylimit);
  147.  
  148.    fg_setpage(hidden);
  149.  
  150.    /* redraw the screen under the window */
  151.  
  152.    x2 += 3;
  153.  
  154.    if (mode06 || mode11)
  155.       fg_drect(x1,x2,y1,y2+2,matrix1);
  156.    else
  157.    {
  158.       fg_setcolor(15);
  159.       fg_rect(x1,x2,y1,y2+2);
  160.       fg_setcolor(14);
  161.       fg_drect(x1,x2,y1,y2+2,matrix2);
  162.    }
  163.  
  164.    /* wait for keystroke or mouse button */
  165.  
  166.    fg_setpage(visual);
  167.    fg_mousevis(ON);
  168.    wait_for_keystroke();
  169.  
  170.    /* clear the screen and return to the menu */
  171.  
  172.    fg_mousevis(OFF);
  173.    fg_restore(0,xlimit,menu_bottom,ylimit);
  174.  
  175.    fg_mousevis(ON);
  176.    redraw = TRUE;
  177.  
  178.    return(OK);
  179. }
  180.  
  181. /**********************************************************************\
  182. *                                                                      *
  183. *  coordinates -- about coordinate systems                             *
  184. *                                                                      *
  185. \**********************************************************************/
  186.  
  187. int coordinates()
  188. {
  189.    static char *string[] = {
  190.    "Coordinate Systems",
  191.    "Fastgraph supports 3 coordinate systems:  Character",
  192.    "Space, Screen Space and World Space. Character Space",
  193.    "is defined in rows and columns.  Screen Space is",
  194.    "defined by the pixel resolution of the video mode.",
  195.    "World Space is a real number coordinate system defined",
  196.    "by the programmer."
  197.    };
  198.  
  199.    /* clear the screen and display the info window */
  200.  
  201.    fg_mousevis(OFF);
  202.    fg_restore(0,xlimit,menu_bottom,ylimit);
  203.    info_window(100,540,60,string,7);
  204.  
  205.    /* wait for keystroke or mouse button */
  206.  
  207.    fg_mousevis(ON);
  208.    wait_for_keystroke();
  209.  
  210.    /* clear the screen and return to the menu */
  211.  
  212.    fg_mousevis(OFF);
  213.    fg_restore(0,xlimit,menu_bottom,ylimit);
  214.  
  215.    fg_mousevis(ON);
  216.    redraw = TRUE;
  217.  
  218.    return(OK);
  219. }
  220.  
  221. /**********************************************************************\
  222. *                                                                      *
  223. *  physical_pages -- about physical pages                              *
  224. *                                                                      *
  225. \**********************************************************************/
  226.  
  227. int physical_pages()
  228. {
  229.    static char *string[] = {
  230.    "Physical Pages",
  231.    "Physical pages are useful for fast image display",
  232.    "and animation.  The number of physical pages",
  233.    "available is dependent on the video mode and the",
  234.    "amount of memory on your video card."
  235.    };
  236.  
  237.    /* clear the screen and display the info window */
  238.  
  239.    fg_mousevis(OFF);
  240.    fg_restore(0,xlimit,menu_bottom,ylimit);
  241.    info_window(120,520,60,string,5);
  242.  
  243.    /* wait for keystroke or mouse button */
  244.  
  245.    fg_mousevis(ON);
  246.    wait_for_keystroke();
  247.  
  248.    /* clear the screen and return to the menu */
  249.  
  250.    fg_mousevis(OFF);
  251.    fg_restore(0,xlimit,menu_bottom,ylimit);
  252.  
  253.    fg_mousevis(ON);
  254.    redraw = TRUE;
  255.  
  256.    return(OK);
  257. }
  258.  
  259. /**********************************************************************\
  260. *                                                                      *
  261. *  virtual_pages -- about virtual pages                                *
  262. *                                                                      *
  263. \**********************************************************************/
  264.  
  265. int virtual_pages()
  266. {
  267.    static char *string[] = {
  268.    "Virtual Pages",
  269.    "If you don't have enough memory on your video card",
  270.    "for physical pages, Fastgraph will let you use RAM to",
  271.    "create virtual pages in some video modes.",
  272.    };
  273.  
  274.    /* clear the screen and display the info window */
  275.  
  276.    fg_mousevis(OFF);
  277.    fg_restore(0,xlimit,menu_bottom,ylimit);
  278.    info_window(100,540,60,string,4);
  279.  
  280.    /* wait for keystroke or mouse button */
  281.  
  282.    fg_mousevis(ON);
  283.    wait_for_keystroke();
  284.  
  285.    /* clear the screen and return to the menu */
  286.  
  287.    fg_mousevis(OFF);
  288.    fg_restore(0,xlimit,menu_bottom,ylimit);
  289.  
  290.    fg_mousevis(ON);
  291.    redraw = TRUE;
  292.  
  293.    return(OK);
  294. }
  295.